package com.derbysoft.dswitch.adapter.ihg.dswitch3.translate.impl;


import com.derbysoft.dswitch.adapter.ihg.dto.OTAHotelAvailRQ;
import com.derbysoft.dswitch.adapter.ihg.dswitch3.translate.Translator;
import com.derbysoft.dswitch.remote.hotel.dto.HotelAvailRequest;
import org.springframework.stereotype.Component;

/**
 * Created by: jason
 * Date: 2012-5-8
 */
@Component("hotelAvailRQTranslator")
public class HotelAvailRQTranslatorImpl extends BaseTranslator
        implements Translator<HotelAvailRequest, OTAHotelAvailRQ, Void> {

    @Override
    public OTAHotelAvailRQ translate(HotelAvailRequest hotelAvailRequest, Void aVoid) {
        OTAHotelAvailRQ hotelAvailabilityRequest = new OTAHotelAvailRQ();
        setRequestAttributes(hotelAvailabilityRequest, hotelAvailRequest);
        String hotelPassport = hotelAvailRequest.getHotelAvailRQ().getAvailCriteria().getHotelCodesList().get(0);
        hotelAvailabilityRequest.setAvailRequestSegments(translateAvailRequestSegments(hotelPassport, hotelAvailRequest));
        return hotelAvailabilityRequest;
    }
}
